#include<stdio.h>
#include<gtk/gtk.h>
#include<stdlib.h>
#include<string.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>

#define MAXSIZE 100
#define N 100


char *filename;
char fname[N];
GtkWidget *FileWin;
GtkWidget *window1; 


static gboolean release_resourse(GtkWidget *widget,GdkEvent *event,gpointer data);
void  FileSelection(int argc,char* argv[]);
void FileSend();




/**************************************关闭窗口回应**********************************/
static gboolean release_resourse(GtkWidget *widget,GdkEvent *event,gpointer data)
{
    gtk_main_quit();
    return FALSE;
}



/**************************************登录界面*********************************************/

int main(int argc,char *argv[])
{
    
    GtkWidget *button1;
    GtkWidget *button2; 
    GtkWidget *button3;
    GtkWidget *fixed;
    
    gtk_init(&argc,&argv);
    window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title((GtkWindow*)window1,"FILE");//标题
    gtk_widget_set_usize(window1,540,375);
    gtk_container_set_border_width(GTK_CONTAINER(window1),10);
    gtk_window_set_position(GTK_WINDOW(window1),GTK_WIN_POS_CENTER);
    

    button1 = gtk_button_new_with_label("SendF");
    button2 = gtk_button_new_with_label("RevF");
    button3 = gtk_button_new_with_label("SelectF");

    fixed = gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(window1),fixed);
    gtk_fixed_put(GTK_FIXED(fixed),button1,110,300);
    gtk_fixed_put(GTK_FIXED(fixed),button2,110,200);
    gtk_fixed_put(GTK_FIXED(fixed),button3,110,100);
   
    gtk_widget_set_size_request(button1,310,50);
    gtk_widget_set_size_request(button2,310,50);
    gtk_widget_set_size_request(button3,310,50);
   

    /***************写回调函数**********************************************************/
    g_signal_connect(G_OBJECT(button1),"pressed",G_CALLBACK(FileSend),NULL);
    //g_signal_connect(G_OBJECT(button2),"pressed",G_CALLBACK(),NULL);
    g_signal_connect(G_OBJECT(button3),"pressed",G_CALLBACK(FileSelection),NULL);
    g_signal_connect(G_OBJECT(window1),"delete_event",G_CALLBACK(release_resourse),NULL);


    gtk_widget_show_all(window1);
    gtk_main();
    
}

    
